package com.ExaminStudy;

import java.util.Scanner;

public class Test46 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请你输入n值");
        int n=sc.nextInt();
        double sum=1;
        double num;
        for (int i = 2; i <=n; i++) {
            if(i%2==0){
                num=(-1)*(1.0/GetSum(i));
            }else{
                 num=1.0/GetSum(i);
            }
            sum+=num;
        }
        System.out.println(sum);
    }
    public static int GetSum (int a){
        if(a==1){
            return 1;
        }else {
            return a*GetSum(a-1);
        }
    }
}
